package com.migration.model.migration.scripts;

import com.migration.model.migration.AbstractMigrationScript;

/**
 * 设备文档关系表(risk_device_doc)迁移脚本
 */
public class A008_RiskDeviceDocMigrationScript extends AbstractMigrationScript {

    /**
     * 构造函数，初始化迁移配置
     */
    public A008_RiskDeviceDocMigrationScript() {
        super(
            "risk_device_doc",
            "设备文档关系数据迁移",
            "ra_document_node",
            "risk_device_doc",
            8
        );
    }

    /**
     * 生成迁移数据的SQL
     *
     * @return 迁移数据的SQL
     */
    @Override
    protected String generateMigrationSql() {
        return "INSERT INTO risk_device_doc (id, doc_id, device_id)\n" +
               "SELECT id, file_id, node_id\n" +
               "FROM risk_lunnan_test.ra_document_node;";
    }

    /**
     * 获取源数据SQL
     *
     * @return 源数据查询SQL
     */
    public String getSourceSql() {
        return "SELECT id, file_id, node_id\n" +
               "FROM risk_lunnan_test.ra_document_node;";
    }

    /**
     * 获取目标数据SQL模板
     *
     * @return 目标数据SQL模板
     */
    public String getTargetSqlTemplate() {
        return "INSERT INTO risk_device_doc (id, doc_id, device_id)";
    }
}
